import { CUSTOMER_TYPE_LIST, AUTHENTICATION_STATUS_LIST } from '@/const/type';
export const tableOption = () => {
  return {
    ...window.$crudMixins.tableOptions,
    addBtn: false,
    editBtn: false,
    delBtn: false,
    menuWidth: 120,
    viewBtn: true,
    viewTitle: '查看用户详情',
    searchLabelWidth: 100,
    column: [
      {
        label: '用户头像',
        prop: 'avatar',
        type: 'upload',
        listType: 'picture-img',
        span: 12,
        fileSize: 10 * 1024,
        propsHttp: {
          name: 'hash',
          url: 'key',
        },
        fileType: 'img', //img/video/audio
        // action: 'http://upload-z2.qiniup.com',
        oss: 'qiniu',
        cropperOption: {
          enlarge: 2,
          fixed: true,
          fixedNumber: [0.83, 1],
        },
        tip: '请上传jpg/png/jpeg/webp/heic类型的文件，最大可上传10M',
        accept: '.jpg,.png,.jpeg,.webp,.heic',
        limit: 1,
        hide: true,
        viewDisplay: true,
      },
      {
        fixed: true,
        label: '用户编号',
        prop: 'code',
        search: true,
        width: 160,
      },
      {
        label: '注册时间',
        prop: 'registerTime',
        type: 'datetime',
        order: 1,
        width: 160,
        format: 'yyyy-MM-dd HH:mm:ss',
        valueFormat: 'yyyy-MM-dd HH:mm:ss',
        search: true,
        searchRange: true,
        searchslot: true,
      },
      {
        type: 'input',
        label: '用户昵称',
        prop: 'nickname',
        search: true,
        rules: [
          {
            required: true,
            message: '请输入用户名',
          },
          {
            min: 3,
            max: 20,
            message: '长度在 3 到 20 个字符',
            trigger: 'blur',
          },
        ],
        width: 160,
        overHidden: true,
      },

      {
        type: 'input',
        label: '手机号',
        prop: 'phone',
        search: true,
        width: 160,
        rules: [
          {
            min: 11,
            max: 11,
            required: true,
            message: '长度在 11 个字符',
            trigger: 'blur',
          },
        ],
      },

      {
        type: 'select',
        label: '实名认证',
        prop: 'authFlag',
        dicData: AUTHENTICATION_STATUS_LIST,
      },
      {
        label: '姓名',
        prop: 'name',
        hide: true,
      },
      {
        label: '身份证号',
        prop: 'idCard',
        hide: true,
      },
      {
        type: 'select',
        label: '性别',
        prop: 'sex',
        dicUrl: '/admin/dict/type/sex',
      },
      {
        label: '生日',
        prop: 'birth',
        width: 120,
      },
      {
        type: 'input',
        label: '当前城市',
        prop: 'district',
        overHidden: true,
        width: 130,
        rules: [
          {
            min: 2,
            max: 64,
            required: true,
            message: '请输入姓名',
            trigger: 'blur',
          },
        ],
      },
      {
        label: '注册渠道',
        prop: 'registerChannel',
        search: true,
        // dicUrl: '/admin/dict/type/channel_type',
      },
      {
        label: '手机系统类型',
        prop: 'deviceCode',
        width: 120,
      },
      {
        label: '平台类型',
        prop: 'platformType',
        search: true,
        type: 'select',
        value: '',
        dicData: [
          {
            label: '全部',
            value: '',
          },
          {
            label: '小程序',
            value: 'MP',
          },
          {
            label: 'APP',
            value: 'APP',
          },
          {
            label: 'H5',
            value: 'H5',
          },
        ],
      },
      {
        label: '推广渠道',
        prop: 'channel',
        width: 120,
        overHidden: true,
        span: 12,
      },
      {
        label: '广告版位',
        prop: 'channelKey',
        width: 120,
        overHidden: true,
        span: 12,
      },
      {
        label: '类型',
        prop: 'type',
        type: 'select',
        search: true,
        rules: [
          {
            required: true,
            message: '请选择用户类型',
            trigger: 'blur',
          },
        ],
        dicData: CUSTOMER_TYPE_LIST,
      },
      {
        label: '状态',
        prop: 'lockFlag',
        type: 'select',
        rules: [
          {
            required: true,
            message: '请选择状态',
            trigger: 'blur',
          },
        ],
        dicData: [
          {
            label: '有效',
            value: '0',
          },
          {
            label: '锁定',
            value: '9',
          },
        ],
      },
      {
        label: '是否黑名单',
        prop: 'blackFlag',
        search: true,
        type: 'select',
        dicData: [
          {
            label: '是',
            value: '1',
          },
          {
            label: '否',
            value: '0',
          },
        ],
      },
      {
        prop: 'description',
        type: 'textarea',
        label: '个人简介',
        minRows: 7,
        hide: true,
        span: 24,
      },
      // {
      //   label: '用户标签',
      //   prop: 'labelList',
      //   type: 'select',
      //   dicUrl: '/app/appuser/label/list',
      //   multiple: true,
      //   hide: true,
      //   props: {
      //     label: 'name',
      //     value: 'id',
      //   },
      // },
      {
        label: '用户标签',
        prop: 'labelList',
        slot: true,
        hide: true,
      },
      {
        label: '备注',
        prop: 'remark',
        type: 'textarea',
        maxlength: 100,
        minRows: 7,
        showWordLimit: true,
        span: 24,
        hide: true,
      },
    ],
  };
};
